/**
 * Created by abdulazizalonizi on 8/15/17.
 */
public class Task3 {
    public static void main (String[] args)
    {
        Point[] pointsArr = new Point[5];
        Point origin = new Point(0,0);

        pointsArr[0] = new Point(3,5);
        pointsArr[1] = new Point(3,8);
        pointsArr[2] = new Point(4,-1);
        pointsArr[3] = new Point(2,-3);
        pointsArr[4] = new Point(1,7);

        double distance = pointsArr[0].distanceFrom(origin);
        int index = 0 ;
        for (int i = 0 ; i <pointsArr.length ; i++)
        {
            if (pointsArr[i].distanceFrom(origin) < distance )
            {
                distance = pointsArr[i].distanceFrom(origin);
                index = i ;

            }

        }

        System.out.println("closest distance is "+distance+" from point " + pointsArr[index]);




    }


}

